/****************************************************************************\
 * @file    game_map.c
 * @author  马新硕
 * @date    2022/10/19
 * @brief   游戏的地图
 * @note    
 ******************************************************************************
 * @attent  
 ****************************************************************************/
#include "game_map.h"

static void mapBarrier_Init(Barrier_t *barrier, int16_t Center_x, int16_t Center_y);//地图不可破坏障碍初始化
static void mapBarrier01_Init(Barrier_t *barrier, int16_t Center_x, int16_t Center_y);//地图不可破坏障碍初始化
static void mapDesBarrier_Init(DestructibleBarrier_t *barrier, int16_t Center_x, int16_t Center_y);//地图可破坏障碍初始化

void gameMap00_Create(void)
{
  
}

void gameMap01_Create(void)
{
  mapBarrier_Init(&mapBarrier[0], 72, 56);
  mapBarrier_Init(&mapBarrier[1], 72, 72);
	mapBarrier_Init(&mapBarrier[2], 72, 88);
	mapBarrier_Init(&mapBarrier[3], 136, 120);
  mapBarrier_Init(&mapBarrier[4], 152, 120);
	mapBarrier_Init(&mapBarrier[5], 168, 120);
  mapBarrier_Init(&mapBarrier[6], 184, 120);
	mapBarrier_Init(&mapBarrier[7], 248, 152);
	mapBarrier_Init(&mapBarrier[8], 248, 168);
	mapBarrier_Init(&mapBarrier[9], 248, 184);
	mapDesBarrier_Init(&mapDesBarrier[0], 136, 144);
	mapDesBarrier_Init(&mapDesBarrier[1], 152, 144);
	mapDesBarrier_Init(&mapDesBarrier[2], 168, 144);
	mapDesBarrier_Init(&mapDesBarrier[3], 184, 144);
}

void gameMap02_Create(void)
{
  mapBarrier_Init(&mapBarrier[0], 72, 56);
  mapBarrier_Init(&mapBarrier[1], 88, 56);
	mapBarrier_Init(&mapBarrier[2], 232, 56);
	mapBarrier_Init(&mapBarrier[3], 248, 56);
	mapBarrier_Init(&mapBarrier[4], 72, 72);
	mapBarrier_Init(&mapBarrier[5], 248, 72);
  mapBarrier_Init(&mapBarrier[6], 72, 168);
	mapBarrier_Init(&mapBarrier[7], 248, 168);
	mapBarrier_Init(&mapBarrier[8], 72, 184);
	mapBarrier_Init(&mapBarrier[9], 88, 184);
	mapBarrier_Init(&mapBarrier[10], 232, 184);
	mapBarrier_Init(&mapBarrier[11], 248, 184);
	mapBarrier01_Init(&mapBarrier[12], 160, 120);
	mapDesBarrier_Init(&mapDesBarrier[0], 136, 64);
	mapDesBarrier_Init(&mapDesBarrier[1], 152, 64);
	mapDesBarrier_Init(&mapDesBarrier[2], 168, 64);
	mapDesBarrier_Init(&mapDesBarrier[3], 184, 64);
	mapDesBarrier_Init(&mapDesBarrier[4], 136, 192);
	mapDesBarrier_Init(&mapDesBarrier[5], 152, 192);
	mapDesBarrier_Init(&mapDesBarrier[6], 168, 192);
	mapDesBarrier_Init(&mapDesBarrier[7], 184, 192);
}

void gameMap03_Create(void)
{
	mapBarrier01_Init(&mapBarrier[0], 160, 120);
}

//地图不可破坏障碍初始化
static void mapBarrier_Init(Barrier_t *barrier, int16_t Center_x, int16_t Center_y)
{
  barrier->pPic = Barrier.pPic;
  barrier->Pixel_x = Barrier.Pixel_x;
  barrier->Pixel_y = Barrier.Pixel_y;
  barrier->Center_x = Center_x;
  barrier->Center_y = Center_y;
  barrier->Vertec_x = barrier->Center_x - barrier->Pixel_x/2;
  barrier->Vertec_y = barrier->Center_y - barrier->Pixel_y/2;
  barrier->LeftBoundary = barrier->Vertec_x;                          //左边界
  barrier->RightBoundary = barrier->Vertec_x + barrier->Pixel_x;      //右边界
  barrier->UpBoundary = barrier->Vertec_y;                            //上边界
  barrier->DownBoundary = barrier->Vertec_y + barrier->Pixel_y;       //下边界
  barrier->isCreated = 1;
}

static void mapBarrier01_Init(Barrier_t *barrier, int16_t Center_x, int16_t Center_y)
{
  barrier->pPic = Barrier01.pPic;
  barrier->Pixel_x = Barrier01.Pixel_x;
  barrier->Pixel_y = Barrier01.Pixel_y;
  barrier->Center_x = Center_x;
  barrier->Center_y = Center_y;
  barrier->Vertec_x = barrier->Center_x - barrier->Pixel_x/2;
  barrier->Vertec_y = barrier->Center_y - barrier->Pixel_y/2;
  barrier->LeftBoundary = barrier->Vertec_x;                          //左边界
  barrier->RightBoundary = barrier->Vertec_x + barrier->Pixel_x;      //右边界
  barrier->UpBoundary = barrier->Vertec_y;                            //上边界
  barrier->DownBoundary = barrier->Vertec_y + barrier->Pixel_y;       //下边界
  barrier->isCreated = 1;
}

//地图可破坏障碍初始化
static void mapDesBarrier_Init(DestructibleBarrier_t *barrier, int16_t Center_x, int16_t Center_y)
{
  barrier->pPic = DesBarrier.pPic;
  barrier->Pixel_x = DesBarrier.Pixel_x;
  barrier->Pixel_y = DesBarrier.Pixel_y;
  barrier->Center_x = Center_x;
  barrier->Center_y = Center_y;
  barrier->Vertec_x = barrier->Center_x - barrier->Pixel_x/2;
  barrier->Vertec_y = barrier->Center_y - barrier->Pixel_y/2;
  barrier->LeftBoundary = barrier->Vertec_x;                          //左边界
  barrier->RightBoundary = barrier->Vertec_x + barrier->Pixel_x;      //右边界
  barrier->UpBoundary = barrier->Vertec_y;                            //上边界
  barrier->DownBoundary = barrier->Vertec_y + barrier->Pixel_y;       //下边界
  barrier->isCreated = 1;
	barrier->isExist = 1;
}
